<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // ['1','3','5','3','5','3','8','9'] 统计次数 次数最大的次数是谁
      let arr = ['1', '3', '5', '3', '5', '3', '8', '9']
      let a = {}
      let b = 0
      arr.map((item) => {
        if (a[item]) {
          a[item]++
        } else {
          a[item] = 1
        }
        if (a[item] > b) {
          b = a[item]
        }
      })
      console.log(a)
      console.log(`次数最多的是${b}`);
    </script>
  </body>
</html>
